package ooday03.Demo.practice02;

public class RefArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("小黑",1,"黑");
        dogs[1]=new Dog("阿黑",2,"黄");
        dogs[2]=new Dog("阿五",2,"蓝");
        dogs[1].age=5;
        dogs[2].swim();
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        System.out.println();
        Chick[] chicks=new Chick[2];
        chicks[0]=new Chick("阿强",1,"黑");
        chicks[1]=new Chick("阿旺",2,"蓝");
        for (int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].name);
            chicks[i].eat();
        }
        System.out.println();
        Fish[] fishs=new Fish[2];
        fishs[0]=new Fish("阿打",1,"蓝");
        fishs[1]=new Fish("小黄",2,"黑");
        for (int i=0;i<fishs.length;i++){
            System.out.println(fishs[i].color);
            fishs[i].drink();
        }
    }
}
